<?php

class Web_Wgt_ColLeft
{

    public function render()
    {
        global $db;

        $rs = $db->fetchAll($db->select()
                                ->from('ma_categorias')
                                ->where('cat_estado=?', 1)
                                ->where('cat_padre_id=?', 0));

//        print_r($rs);

        $rs2 = $db->fetchAll($db->select()
                                ->from('ma_categorias')
                                ->where('cat_estado=?', 1)
                                ->where('cat_padre_id!=?', 0));

//        print_r($rs2);

        $smarty = new Smarty_Engine();
        $smarty->assign('categorias', $rs);
        $smarty->assign('subcategorias', $rs2);

        return $smarty->fetch(TPL_ROOT . DS . 'wgt-col-left.tpl');
    }

}